from qiyeweixin.page_objects.page_base import PageBase
from selenium.webdriver.common.by import By
from qiyeweixin.utils_tool.logging_info import logger

'''添加成员信息页面'''
class PageCreateMember(PageBase):

    __IPT_USERNAME = (By.NAME, "username")
    __IPT_ACCTID = (By.ID, "memberAdd_acctid")
    __IPT_MAIL = (By.ID, "memberAdd_biz_mail")
    __IPT_PTHONE = (By.ID, "memberAdd_phone")
    __BTN_SAVE = (By.XPATH, "//*[text()='保存']")

    #添加成员信息页面：输入成员个人信息后保存
    def create_member(self):

        self.mail = self.fake.postcode()

        logger.info("2、成员信息页面：输入成员个人信息后保存")
        self.do_send_keys(self.username, self.__IPT_USERNAME)
        self.do_send_keys(self.acctid, self.__IPT_ACCTID)
        self.do_send_keys(self.mail, self.__IPT_MAIL)
        self.do_send_keys(self.mobile, self.__IPT_PTHONE)
        self.do_click(self.__BTN_SAVE)

        from qiyeweixin.page_objects.page_address_book import PageAddressBook
        return PageAddressBook(self.driver)



